<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="manifest" href="./manifest.json">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="apple-touch-iconapple-touch-icon" sizes="57x57" href="icons/apple-icon-57x57.png">
<link rel="icon" sizes="36x36" href="icons/android-icon-60x60.png">
<link rel="icon" sizes="48x48" href="icons/android-icon-72x72.png">
<link rel="icon" sizes="72x72" href="icons/android-icon-72x72.png">
<link rel="icon" sizes="96x96" href="icons/android-icon-76x76.png">
<link rel="icon" sizes="144x144" href="icons/android-icon-144x144.png">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="theme-color" content="#ffffff">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="application-name" content="chao">
<meta name="apple-mobile-web-app-title" content="chao">
<meta name="msapplication-starturl" content="/">

<script>
if ('serviceWorker' in navigator) {
  window.addEventListener('load', function() {
    navigator.serviceWorker.register('./sw.js').then(function(registration) {
      // Registration was successful
    //   setInterval(function() {
    //      console.log('setInterval');
    //      registration.update();
    //  }, 4000);
      console.log('ServiceWorker registration successful with scope: ', registration);
    }, function(err) {
      // registration failed :(
      console.log('ServiceWorker registration failed: ', err);
    });
  });
}

 window.addEventListener('beforeinstallprompt', function(e) {
      // beforeinstallprompt Event fired

      // e.userChoice will return a Promise. 
      // For more details read: https://developers.google.com/web/fundamentals/getting-started/primers/promises
      e.userChoice.then(function(choiceResult) {

        console.log(choiceResult.outcome);

        if (choiceResult.outcome == 'dismissed') {
          console.log('User cancelled home screen install');
        } else {
          console.log('User added to home screen');
        }
      });
    });

</script>

  <title>诗歌江湖</title>

  <link rel="stylesheet" href="style/style.css">

  <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
  <script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
  <script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

<style>
   html,body{
     width: 100%;
     height: 100%;
   }
  .fixed1 { position: fixed; right: 0; left: 0; z-index: 1030; bottom: 0; margin-bottom: 0; border-width: 1px 0 0;}

#mode1 .col{
  padding: 1rem;
}

</style>


</head>
<body>

      <nav class="nav nav-pills nav-justified navbar-fixed-top fixed1">
        <a class="nav-item nav-link active" id="pills-home-tab" data-toggle="pill" href="#pills-home" role="tab" aria-controls="pills-home" aria-selected="true">诗</a>
        <a class="nav-item nav-link" id="pills-profile-tab" data-toggle="pill" href="#pills-profile" role="tab" aria-controls="pills-profile" aria-selected="false">影</a>
        <a class="nav-item nav-link" id="pills-contact-tab" data-toggle="pill" href="#pills-contact" role="tab" aria-controls="pills-contact" aria-selected="false">江湖</a>
      </nav>

   
    <div class="tab-content" id="pills-tabContent" style="height: 100%">
      <div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab">

        <div id="mode1" class="container-fluid" style="height: 100%;">

            <div class="row" style="height: 80%;">
              <div class="col-md-6 col-lg-6 col-sm-12" style="height: 100%;">
                  <div class="card" style="width: 100%;height: 100%;">
                     
                      <div class="card-body">
                        <h2 class="card-title">每日一首小诗</h2>
                        <p class="card-text">广告位</p>
                      </div>
                    </div>
              </div>
              <div class="col-md-6 col-lg-6 col-sm-12" style="height: 100%;">
                  <div class="card" style="width: 100%;height: 100%">
                      <div class="card-body">
     
                        <div class="row">
                          <div class="col">
                              <label id="firstSolar" class="yang" style="display: none;">233333</label>  
                              <label id="todaySolar" class="yang">233333</label>
                              <label id="todayLunar" class="yin">23333</label>
                              <label id="firstLunar" class="yin" style="display: none;">23333</label>
                          </div>
                        </div>
                        <h5 id="ptitle">bug</h5>
                        <h5 id="pauthor">bug</h5>
                        <div id="pcontent" class="poetry-content">
                            <p>世界上最远的距离是</p>
                        
                            <p>我明明站在你面去前</p>
                        
                            <p>而你却没有网</p>
                        
                            <p>可惜可惜</p>
                        </div>
                    
                      </div>
                    </div>
  
              </div>
            </div>
          </div>


      </div>
      <div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab">
           <iframe id="page2" align="center" width="100%" height="100%" src="./html/time.html"  frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="yes"></iframe> 


      </div>
      <div class="tab-pane fade" style="height: 100%;" id="pills-contact" role="tabpanel" aria-labelledby="pills-contact-tab">
        
        <div  class="container-fluid" style="height: 100%;">

          <div class="row" style="height: 100%;">
            <div class="col" style="height: 50%;">
              <h3 style="color: red">很急很重要</h3>
              <div class="form-group">
                  <!-- <label for="exampleFormControlTextarea1">Example textarea</label> -->
                  <textarea class="form-control" id="exampleFormControlTextarea1" rows="3"></textarea>
                </div>
            </div>
            <div class="col" style="height: 50%;">
                <h3 style="color: orange">很重要不急</h3>
                <div class="form-group">
                    <!-- <label for="exampleFormControlTextarea1">Example textarea</label> -->
                    <textarea class="form-control" id="exampleFormControlTextarea1" rows="3"></textarea>
                  </div>

            </div>
            <div class="w-100"></div>
            <div class="col" style="height: 50%;">
                <h3 style="color:blue">不重要很急</h3>
                <div class="form-group">
                    <!-- <label for="exampleFormControlTextarea1">Example textarea</label> -->
                    <textarea class="form-control" id="exampleFormControlTextarea1" rows="3"></textarea>
                  </div>

            </div>
            <div class="col" style="height: 50%;">
                <h3 style="color: greenyellow">不重要不急</h3>
                <div class="form-group">
                    <!-- <label for="exampleFormControlTextarea1">Example textarea</label> -->
                    <textarea class="form-control" id="exampleFormControlTextarea1" rows="3"></textarea>
                  </div>

            </div>
          </div>
        </div>




      </div>
    </div>


    

    
    
    
     
      <footer>
    </footer>

  </div>
  <script src="assets/js/calendar.js"></script>
  <script src="assets/js/web.js"></script>
  <script src="assets/js/节日表.js"></script>
  <script src="assets/js/诗词表.js"></script>
  <script src="assets/js/images.js"></script>
  <script src="assets/js/tang300.js"></script>
<script>
$(function(){

var ifheight=document.body.clientHeight
$("#page2").attr("height",ifheight)
      

var url = new URL(window.location.href);
    
        render(new Date())



})


  function render(t) {
            window.day = t;
            var ji = getJijie(t)
            var jijieFlower = JIJIEMAP[ji]

            var currentWeekNumber = weekNumber(t);
            var currentDayNumber = dayNumber(t);
            var currentMonday = monDay(t);
            var currentWeeks = weekDays(currentMonday);

            var day = calendar.solar2lunar(t.getFullYear(), t.getMonth() + 1, t.getDate());

            var lunarDate = day.gzYear + '·' + day.IMonthCn + day.IDayCn;
            var solarDate = day.cYear + '.' + day.cMonth + '.' + day.cDay + '   ' + day.ncWeek;

            document.getElementById("todayLunar").innerHTML = lunarDate
            document.getElementById("todaySolar").innerHTML = solarDate


            // Poetry每周一首
            //var poetry = weekPoetry[currentWeekNumber[1] - 1]
            //每天一首
            var poetry = dayPoetrys[currentDayNumber[1] - 1]

            if (!poetry) {
                var poetry = poetrys[Math.floor(Math.random() * poetrys.length)];
                poetry.content = poetry.paragraphs
            }

            // images
            // if (poetry.image) {
            //     var image = images[poetry.image]
            // } else {
            //     var image = allImages[Math.floor(Math.random() * allImages.length)];
            // }

   

            // dynasty
            if (poetry.dynasty) {
                var author = poetry.dynasty + '·' + poetry.author;
            } else {
                var author = poetry.author;
            }

            setContentP2(poetry.paragraphs)
            document.getElementById("ptitle").innerHTML = poetry.title
            document.getElementById("pauthor").innerHTML = author

            var weekIds = ["w1", "w2", "w3", "w4", "w5", "w6", "w7"]
            var firstSolar = ""
            var firstLunar = ""


            for (var i in weekIds) {
                var id = weekIds[i];
                var solar = currentWeeks[i];
                var lunar = calendar.solar2lunar(
                    solar.getFullYear(), 
                    solar.getMonth() + 1, 
                    solar.getDate()
                );


                if (id === 'w1') {
                    firstSolar = firstSolar + pad(lunar.cMonth) + '.' + pad(lunar.cDay) + ''
                    firstLunar = firstLunar + pad(lunar.IMonthCn) + pad(lunar.IDayCn);
                }


                if (id === 'w7') {
                    titleSolar = lunar.cYear + '-' + '第' + pad(currentWeekNumber[1]) + '周';
                    firstSolar = firstSolar + '~' + pad(lunar.cMonth) + '.' + pad(lunar.cDay) + ''
                    firstLunar = firstLunar + '~' + pad(lunar.IMonthCn) + pad(lunar.IDayCn);
                    document.getElementById("firstSolar").innerHTML = firstSolar
                    document.getElementById("firstLunar").innerHTML = firstLunar

                    document.title = '诗词周历-' + titleSolar + '-' + firstSolar;
                }

                var el = document.getElementById(id);

                if (solar.getDate() === t.getDate()) {
                    if (lunar.lMonth === 4 && lunar.lDay === 26) {
                        setContentP(["祝你生日快乐", "祝你生日快乐", "祝你生日快乐","祝你生日快乐~~"])
                        document.getElementById("ptitle").innerHTML = "生日歌"
                        document.getElementById("pauthor").innerHTML = "党中央"
                    }
                } else {
                   
                }

                console.log(lunar.cYear, window.year)

              

                // document.getElementById("todaySolar").innerHTML = lunar.cDay

                // var lunarElement = document.getElementById("todayLunar")

                // var nextDay = new Date(solar.getFullYear(),  solar.getMonth(), solar.getDate())
                // nextDay.setDate(solar.getDate() + 1);
            
                // var nextDay = calendar.solar2lunar(
                //     nextDay.getFullYear(), 
                //     nextDay.getMonth() + 1, 
                //     nextDay.getDate()
                // );

                // if (nextDay.IMonthCn + nextDay.IDayCn === '正月初一') {
                //     lunarElement.innerHTML = '除夕'
                //     continue
                // }

                // if (nextDay.Term === '清明') {
                //     lunarElement.innerHTML = '寒食'
                //     continue
                // }

                // if (lunar.IMonthCn + lunar.IDayCn in lundarDayMap) {
                //     lunarElement.innerHTML = lundarDayMap[lunar.IMonthCn + lunar.IDayCn]
                //     continue
                // }

                // if (lunar.cMonth + '.' + lunar.cDay in solarDayMap) {
                //     lunarElement.innerHTML = solarDayMap[lunar.cMonth + '.' + lunar.cDay]
                //     continue
                // }

                // if (lunar.Term) {
                //     lunarElement.innerHTML = lunar.Term
                // } else {
                //     lunarElement.innerHTML = lunar.IDayCn
                // }

            }
        }


</script>

</body>
</html>